/*
 * time.cpp
 *
 *  Created on: May 15, 2009
 *      Author: toc
 */

#include "time.h"

Time::Time()
{
  value = 0.0;
}

Time::Time(double new_value)
{
  value = new_value;
}

Time::~Time()
{
}

bool operator >(Time t1, Time t2)
{
  if (t1.value > t2.value)
    return true;
  return false;
}

bool operator <(Time t1, Time t2)
{
  if (t1.value < t2.value)
    return true;
  return false;
}

Time operator +(Time p1, Time p2)
{
  Time new_p;
  new_p.value = p1.value + p2.value;
  return new_p;
}

Time operator -(Time p1, Time p2)
{
  Time new_p;
  new_p.value = p1.value - p2.value;
  return new_p;
}

void Time::operator =(Time new_p)
{
  value = new_p.value;
}

void Time::operator +=(Time new_p)
{
  value += new_p.value;
}

void Time::operator -=(Time new_p)
{
  value -= new_p.value;
}

bool Time::operator ==(Time p)
{
  if (p.value == value) {
    return true;
  }
  else {
    return false;
  }
}

std::ostream& operator <<(std::ostream &os, const Time &obj)
{
  os << obj.value;
  return os;
}

Time_interval::Time_interval()
{

}

Time_interval::Time_interval(Time start, Time end)
{
  this->start = start;
  this->end = end;
}

Time_interval::~Time_interval()
{

}

Time Time_interval::lenght(void)
{
  return end - start;
}

